package com.wargameproject.map;

import com.wargameproject.Case;
import com.wargameproject.Partie;
import com.wargameproject.terrain.BaseHumain;
import com.wargameproject.terrain.BaseOrque;
import com.wargameproject.terrain.Foret;
import com.wargameproject.terrain.Mer;
import com.wargameproject.terrain.Montagne;
import com.wargameproject.terrain.Neige;
import com.wargameproject.terrain.Plaine;

public class Map2 extends Map{
	
	public Map2() {
		nbLignes = 11;
		nbColonnes = 11;
		cases = new Case[nbLignes][nbColonnes];
	}
		
	public void remplissageMap() {
		for (int i = 0; i < nbLignes; i++) {
			Partie.grille.addView(Partie.lignes[i]);
			for (int j = 0; j < nbColonnes; j++) {

				if (i == 0) {
					if (j == 0) {
						cases[i][j].terrain = new Plaine();
					} else if (j < 2) {
						cases[i][j].terrain = new Plaine();
					} else if (j < 6) {
						cases[i][j].terrain = new Foret();
					} else if (j < 7) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 8) {
						cases[i][j].terrain = new Neige();
					} else if (j < 9) {
						cases[i][j].terrain = new Foret();
					} else {
						cases[i][j].terrain = new Montagne();
					}
				} else if (i == 1) {
					if (j == 0) {
						cases[i][j].terrain = new Plaine();
					} else if (j < 2) {
						cases[i][j].terrain = new Plaine();
					} else if (j < 3) {
						cases[i][j].terrain = new Neige();
					} else if (j < 6) {
						cases[i][j].terrain = new Foret();
					} else if (j < 7) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 9) {
						cases[i][j].terrain = new Neige();
					} else if (j < 10) {
						cases[i][j].terrain = new Foret();
					} else {
						cases[i][j].terrain = new Montagne();
					}
				} else if (i == 2) {
					if (j < 3) {
						cases[i][j].terrain = new Neige();
					} else if (j < 5) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 6) {
						cases[i][j].terrain = new Foret();
					} else if (j < 8) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 10) {
						cases[i][j].terrain = new Neige();
					} else {
						cases[i][j].terrain = new Foret();
					}
				} else if (i == 3) {
					if (j == 0) {
						cases[i][j].terrain = new Foret();
					} else if (j < 2) {
						cases[i][j].terrain = new Neige();
					} else if (j < 4) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 5) {
						cases[i][j].terrain = new Foret();
					} else if (j < 6) {
						cases[i][j].terrain = new Mer();
					} else if (j < 9) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 10) {
						cases[i][j].terrain = new Neige();
					} else {
						cases[i][j].terrain = new Mer();
					}
				} else if (i == 4) {
					if (j == 0) {
						cases[i][j].terrain = new Mer();
					} else if (j < 2) {
						cases[i][j].terrain = new Neige();
					} else if (j < 3) {
						cases[i][j].terrain = new Mer();
					} else if (j < 4) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 6) {
						cases[i][j].terrain = new Mer();
					} else if (j < 10) {
						cases[i][j].terrain = new Neige();
					} else {
						cases[i][j].terrain = new Mer();
					}
				} else if (i == 5) {
					if (j < 3) {
						cases[i][j].terrain = new Mer();
					} else if (j < 4) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 5) {
						cases[i][j].terrain = new Foret();
					} else if (j < 6) {
						cases[i][j].terrain = new Mer();
					} else if (j < 7) {
						cases[i][j].terrain = new Foret();
					} else if (j < 8) {
						cases[i][j].terrain = new Montagne();
					} else {
						cases[i][j].terrain = new Mer();
					}
				} else if (i == 6) {
					if (j == 0) {
						cases[i][j].terrain = new Mer();
					} else if (j < 5) {
						cases[i][j].terrain = new Neige();
					} else if (j < 7) {
						cases[i][j].terrain = new Mer();
					} else if (j < 8) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 9) {
						cases[i][j].terrain = new Mer();
					} else if (j < 10) {
						cases[i][j].terrain = new Neige();
					} else {
						cases[i][j].terrain = new Mer();
					}
				} else if (i == 7) {
					if (j == 0) {
						cases[i][j].terrain = new Mer();
					} else if (j < 2) {
						cases[i][j].terrain = new Neige();
					} else if (j < 5) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 6) {
						cases[i][j].terrain = new Mer();
					} else if (j < 7) {
						cases[i][j].terrain = new Foret();
					} else if (j < 9) {
						cases[i][j].terrain = new Montagne();
					} else {
						cases[i][j].terrain = new Neige();
					}
				} else if (i == 8) {
					if (j == 0) {
						cases[i][j].terrain = new Foret();
					} else if (j < 3) {
						cases[i][j].terrain = new Neige();
					} else if (j < 5) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 6) {
						cases[i][j].terrain = new Foret();
					} else if (j < 8) {
						cases[i][j].terrain = new Montagne();
					} else {
						cases[i][j].terrain = new Neige();
					}
				} else if (i == 9) {
					if (j == 0) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 2) {
						cases[i][j].terrain = new Foret();
					} else if (j < 4) {
						cases[i][j].terrain = new Neige();
					} else if (j < 5) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 8) {
						cases[i][j].terrain = new Foret();
					} else if (j < 10) {
						cases[i][j].terrain = new Neige();
					} else {
						cases[i][j].terrain = new Plaine();
					}
				} else {
					if (j < 2) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 3) {
						cases[i][j].terrain = new Foret();
					} else if (j < 4) {
						cases[i][j].terrain = new Neige();
					} else if (j < 5) {
						cases[i][j].terrain = new Montagne();
					} else if (j < 9) {
						cases[i][j].terrain = new Foret();
					} else {
						cases[i][j].terrain = new Plaine();
					}
				}

				cases[i][j].terrain.position = cases[i][j];
				Partie.lignes[i].addView(cases[i][j]);
			}
		}

		// BASE J1
		if (Partie.joueur1.race == "Humain") {
			cases[0][0].base = new BaseHumain(Partie.joueur1);
		} else {
			cases[0][0].base = new BaseOrque(Partie.joueur1);
		}
		cases[0][0].base.position = cases[0][0];

		// BASE J2
		if (Partie.joueur2.race == "Humain") {
			cases[nbLignes - 1][nbColonnes - 1].base = new BaseHumain(
					Partie.joueur2);
		} else {
			cases[nbLignes - 1][nbColonnes - 1].base = new BaseOrque(
					Partie.joueur2);
		}
		cases[nbLignes - 1][nbColonnes - 1].base.position = cases[nbLignes - 1][nbColonnes - 1];
	}
}
